#include <stdio.h>
#include <stdlib.h>

// 树的结构体
typedef struct BNode{
    int data;
    BNode *lchild;
    BNode *rchild;
}BNode,*BTree;

// 求树的结点个数
int getBNodeNum(BTree T){
    if(T == NULL)
        return 0;
    return getBNodeNum(T->lchild) + getBNodeNum(T->rchild) + 1;
}

// 求树的高度
int getBTreeDepth(BTree T){
    if(T == NULL)
        return 0;
    int lDepth = getBTreeDepth(T->lchild);
    int rDepth = getBTreeDepth(T->rchild);
    return lDepth > rDepth ? lDepth + 1 : rDepth + 1;
}

BNode * GetNode(int x) {
    BNode *node = (BNode *)malloc(sizeof(BNode));
    node->data = x;
    node->lchild = NULL;
    node->rchild = NULL;
    return node;
}

int main() {
    BTree T = GetNode(1);
    T->lchild = GetNode(2);
    T->rchild = GetNode(3);
    T->lchild->lchild = GetNode(4);
    T->rchild->rchild = GetNode(5);
    T->rchild->lchild = GetNode(6);
    int num = getBTreeDepth(T);
    printf("%d ", num);
    return 0;
}